<div>0001</div>
<div>0002</div>
<div>0003</div>

<script>
  (function (window, undefined) {
    function init(ele) {
      let eles = document.querySelectorAll(ele);
      for (let i = 0; i < eles.length; i++) {
        this[i] = eles[i];
      }
      this.length = eles.length;
    }
    let Jquery = function (ele) {
      return new init(ele);
    };
    // 给Jq增加一个快捷操作 也就是静态方法 改静态方法可以给init添加原型方法
    Jquery.extend = function (object) {
      // 采用for  in 遍历
      for (let key in object) {
        init.prototype[key] = object[key];
      }
    };
    init.prototype.css = function (cssAttr, cssVal) {
      for (let i = 0; i < this.length; i++) {
        this[i].style[cssAttr] = cssVal;
      }
    };
    window.jquery = window.$ = Jquery;
  })(window);
  //   let data = $("div");
  //   console.log(data);
  //   data.css("color", "green");
  console.log($("div"));
  $.extend({
    bg: function () {},
  });
</script>
